DEFINITION MODULE GrafMgr;

(*
AES Grafics Manager.

UK __DATE__ __TIME__
*)

(*DEF_SWITCHES*)

FROM PORTAB IMPORT ANYBYTE,UNSIGNEDWORD,SIGNEDWORD;
FROM RcMgr  IMPORT GRect,GPnt;

IMPORT AES;

#if export
EXPORT QUALIFIED GrafRubberBox,GrafRubBox,GrafDragBox,GrafMoveBox,GrafMBox,
                 GrafGrowBox,GrafShrinkBox,TreePtr,ObjectIndex,ObjectState,
                 GrafWatchBox,SlideModes,GrafSlideBox,GrafHandle,
                 Arrow,TextCrsr,BusyBee,Hourglass,Bee,PointHand,FlatHand,
                 ThinCross,ThickCross,OutlnCross,MPush,MPop,UserDef,
                 MOff,MOn,MouseColors,MForm,MFormPtr,GrafMouse,
                 MouseButtons,MouseButton,SpecialKeys,SpecialKey,GrafMKState;
#endif

(* [Graf]ics Manager: Do [Rub]ber] [Box], AES(70) **************************)

PROCEDURE GrafRubberBox(    StartPos   : GPnt;
                            StartWidth : SIGNEDWORD;
                            StartHeight: SIGNEDWORD;
                        VAR LastWidth  : SIGNEDWORD;
                        VAR LastHeight : SIGNEDWORD);

#if proc_const || ISOM2
CONST GrafRubBox = GrafRubberBox;
#else
VAR GrafRubBox: PROCEDURE(GPnt,SIGNEDWORD,SIGNEDWORD,VAR SIGNEDWORD,VAR SIGNEDWORD);
#endif

(* [Graf]ics Manager: [Drag] [Box], AES(71) ********************************)

PROCEDURE GrafDragBox(    StartWidth : SIGNEDWORD;
                          StartHeight: SIGNEDWORD;
                          StartX     : SIGNEDWORD;
                          StartY     : SIGNEDWORD;
                      VAR Bound      : GRect;
                      VAR NewPos     : GPnt);

(* [Graf]ics Manager: [M]ove] [Box], AES(72) *******************************)

PROCEDURE GrafMoveBox(StartWidth : UNSIGNEDWORD;
                      StartHeight: UNSIGNEDWORD;
                      StartPos   : GPnt;
                      EndPos     : GPnt);

#if proc_const || ISOM2
CONST GrafMBox = GrafMoveBox;
#else
VAR GrafMBox: PROCEDURE(UNSIGNEDWORD,UNSIGNEDWORD,GPnt,GPnt);
#endif

(* [Graf]ics Manager: Draw [Grow]ing [Box], AES(73) ************************)

PROCEDURE GrafGrowBox(VAR From: GRect;
                      VAR To  : GRect);

(* [Graf]ics Manager: Draw [Shrink]ing [Box], AES(74) **********************)

PROCEDURE GrafShrinkBox(VAR From: GRect;
                        VAR To  : GRect);

(* [Graf]ics Manager: [Watch] [Box], AES(75) *******************************)

TYPE TreePtr = AES.TreePtr;

     ObjectIndex = AES.ObjectIndex;

     ObjectState = AES.ObjectState;

PROCEDURE GrafWatchBox(PTree   : TreePtr;
                       Ob      : ObjectIndex;
                       Instate : ObjectState;
                       Outstate: ObjectState): BOOLEAN;

(* [Graf]ics Manager: [Slide] [Box], AES(76) *******************************)

TYPE SlideModes = (Horizontal,Vertical);

PROCEDURE GrafSlideBox(PTree : TreePtr;
                       Parent: ObjectIndex;
                       Ob    : ObjectIndex;
                       IsVert: SlideModes): UNSIGNEDWORD;

(* [Graf]ics Manager: Get [Handle] And System Sizes, AES(77) ***************)

PROCEDURE GrafHandle(VAR WChar: UNSIGNEDWORD;
                     VAR HChar: UNSIGNEDWORD;
                     VAR WBox : UNSIGNEDWORD;
                     VAR HBox : UNSIGNEDWORD): UNSIGNEDWORD;

(* [Graf]ics Manager: Show [Mouse] Form, AES(78) ***************************)

CONST Arrow      = 0;
      TextCrsr   = 1;
      BusyBee    = 2; Hourglass = 2; Bee = 2; (* alias *)
      PointHand  = 3;
      FlatHand   = 4;
      ThinCross  = 5;
      ThickCross = 6;
      OutlnCross = 7;

      MPush      = 100;
      MPop       = 101;

      UserDef    = 255;

      MOff       = 256; (* [M]ouse [Off] *)
      MOn        = 257; (* [M]ouse [On]  *)

      MSave      = 258;
      MRestore   = 259;
      MLast      = 260;

TYPE MouseColors = AES.ObjectColors;

     MForm = RECORD
               MFXHot   : UNSIGNEDWORD;
               MFYHot   : UNSIGNEDWORD;
               MFNPlanes: UNSIGNEDWORD;
#if linear
#if fill_byte
               FillByte1: ANYBYTE;
#endif
#endif
               MFFG     : MouseColors;
#if intel
#if fill_byte
               FillByte1: ANYBYTE;
#endif
#endif
#if linear
#if fill_byte
               FillByte2: ANYBYTE;
#endif
#endif
               MFBG     : MouseColors;
#if intel
#if fill_byte
               FillByte2: ANYBYTE;
#endif
#endif
               MFMask   : ARRAY[0..15] OF SIGNEDWORD;
               MFData   : ARRAY[0..15] OF SIGNEDWORD;
             END;
     MFormPtr = POINTER TO MForm;

PROCEDURE GrafMouse(MouseNum : UNSIGNEDWORD;
                    MouseForm: MFormPtr); (* pointer for dynamic mice *)

(* [Graf]ics Manager: Get [M]ouse And [K]eyBoard [State], AES(79) **********)

#ifdef FTLM2
TYPE MouseButtons = AES.MouseButtons;
#else
CONST MBLeft = AES.MBLeft;
      MBRight = AES.MBRight;
#endif

TYPE MouseButton = AES.MouseButton;

#ifdef FTLM2
TYPE SpecialKeys = AES.SpecialKeys;
#else
CONST KRShift = AES.KRShift;
      KLShift = AES.KLShift;
      KCtrl = AES.KCtrl;
      KAlt = AES.KAlt;
#endif

TYPE SpecialKey = AES.SpecialKey;

PROCEDURE GrafMKState(VAR MXY   : GPnt;
                      VAR MState: MouseButton;
                      VAR KState: SpecialKey);

END GrafMgr.
